Skip to content

fix(web): resync model in set osk() (as used by Server)#16127

Merged
mcdurdin merged 3 commits into
masterfrom
fix/developer/15217-resync-model-after-device-switch
Jul 9, 2026
Merged

fix(web): resync model in set osk() (as used by Server)#16127
mcdurdin merged 3 commits into
masterfrom
fix/developer/15217-resync-model-after-device-switch

Conversation

@mcdurdin

@mcdurdin mcdurdin commented Jun 23, 2026

Copy link
Copy Markdown
Member

When a new OSK is attached, we need to set its active keyboard and lexical model. These are undocumented API contracts between Keyman Engine for Web and Keyman Developer Server, so this appears to have changed in v.19 for keyboards (although the sync is also necessary for v.18).

  • Keyboards: before this fix, the keyboard would be blank or missing after switching devices, until another keyboard was selected from the keyboard menu.
  • Models: before this fix, the banner would disappear after switching devices, until another model was selected from the model menu.

@ermshiperete the behaviour for active keyboard has changed between v.18 and v.19. In v.18, switching device, the new osk would receive the active keyboard automatically. But in v.19, we need to assign it in Server. I think we may need to track where the change originates in case it impacts other use cases?

Fixes: #15217
Test-bot: skip

When a new OSK is attached, we need to set its active keyboard and
lexical model. These are undocumented API contracts between Keyman
Engine for Web and Keyman Developer Server, so this appears to have
changed in v.19 for keyboards (although the sync is also necessary for
v.18).

Fixes: #15217
Test-bot: skip
@keymanapp-test-bot

keymanapp-test-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

  • Android
    • Keyman for Android apk - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for Android apk - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for Android apk (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • KeyboardHarness apk - build : all tests passed (no artifacts on BuildLevel "build")
    • Keyman for Android apk (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • KMSample1 apk - build : all tests passed (no artifacts on BuildLevel "build")
    • KMSample2 apk - build : all tests passed (no artifacts on BuildLevel "build")
  • Developer
    • Keyman Developer - build : all tests passed (no artifacts on BuildLevel "build")
    • Compiler Regression Tests - build : all tests passed (no artifacts on BuildLevel "build")
    • Keyman Developer (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • kmcomp.zip - build : all tests passed (no artifacts on BuildLevel "build")
    • kmcomp.zip (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
  • iOS
    • Keyman for iOS (simulator image) - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for iOS (simulator image) - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for iOS (simulator image) (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • Keyman for iOS (simulator image) (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
  • Keyboards
    • Test Keyboards - build : all tests passed (no artifacts on BuildLevel "build")
  • Web
    • KeymanWeb Test Home - build : all tests passed (no artifacts on BuildLevel "build")

@ermshiperete

Copy link
Copy Markdown
Contributor

@ermshiperete the behaviour for active keyboard has changed between v.18 and v.19. In v.18, switching device, the new osk would receive the active keyboard automatically. But in v.19, we need to assign it in Server. I think we may need to track where the change originates in case it impacts other use cases?

Yes, I think it would be good to investigate what changed that causes this different behaviour.

@mcdurdin

Copy link
Copy Markdown
Member Author

Yes, I think it would be good to investigate what changed that causes this different behaviour.

A bisect showed that this regressed in 19.0.241 with the merge of #16015. That's going to be hard to bisect further! I will attempt to step-through the source.

Comment thread developer/src/server/src/site/test.js Outdated
Comment on lines +266 to +268
// After attaching a new OSK, we also need to set the OSK's active keyboard
// and model
newOSK.activeKeyboard = keyman.contextManager.activeKeyboard; // Note: undocumented KeymanWeb API refs on both sides

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After #16156 lands, activeKeyboard is properly set automatically again.

Suggested change
// After attaching a new OSK, we also need to set the OSK's active keyboard
// and model
newOSK.activeKeyboard = keyman.contextManager.activeKeyboard; // Note: undocumented KeymanWeb API refs on both sides
// After attaching a new OSK, we also need to set the OSK's active model

@ermshiperete, should model attachment be resolved web-side also?

@mcdurdin mcdurdin marked this pull request as draft June 29, 2026 13:44
@mcdurdin

Copy link
Copy Markdown
Member Author

Returned to draft in order to discuss whether model fix should be done in Keyman Engine set osk() rather than in Server?

mcdurdin added 2 commits July 2, 2026 14:29
…t osk

After review, it is better to do the sync of the model banner in
KeymanWeb `set osk()` than in the client of the API. The client should
be able to assign a new OSK and have it "just work" without needing to
attach things to it.

Fixes: #15217
@github-actions github-actions Bot added the web/ label Jul 2, 2026
@mcdurdin mcdurdin changed the title fix(developer): resync model and keyboard after device switch in Server fix(web): resync model in set osk() (as used by Server) Jul 2, 2026
@mcdurdin mcdurdin requested review from ermshiperete and jahorton July 2, 2026 12:58
@mcdurdin

mcdurdin commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Returned to draft in order to discuss whether model fix should be done in Keyman Engine set osk() rather than in Server?

Yes, better to make this change in the web source. @jahorton FYI.

@mcdurdin mcdurdin marked this pull request as ready for review July 2, 2026 12:58
@keyman-server keyman-server modified the milestones: A19S32, A19S33 Jul 4, 2026
@mcdurdin mcdurdin merged commit 4ab67f5 into master Jul 9, 2026
16 checks passed
@mcdurdin mcdurdin deleted the fix/developer/15217-resync-model-after-device-switch branch July 9, 2026 08:50
@github-project-automation github-project-automation Bot moved this from Code Review to Done in Keyman Jul 9, 2026
@keyman-server

Copy link
Copy Markdown
Collaborator

Changes in this pull request will be available for download in Keyman version 19.0.253-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug(developer): selecting device after lexical model in Web Test causes LM to not work

4 participants